<?echo '<?xml version="1.0" encoding="UTF-8"?>';?>

<tpb-config>

<?php
/*
echo <<<DOCHERE
  <accesskey>{$this->_get_config_update_param( $config['accesskey'])}</accesskey>
  <sharedsecret>{$this->_get_config_update_param( $config['sharedsecret'])}</sharedsecret>
DOCHERE;
*/
?>

  <accesskey><?php echo trim($this->escape_xml(

        ! is_null( $output = $new_config[ 'accesskey' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'accesskey' }[0]

      )); ?></accesskey> 
  <sharedsecret><?php echo trim($this->escape_xml(

        ! is_null( $output = $new_config[ 'sharedsecret' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'sharedsecret' }[0]

      )); ?></sharedsecret>  
   

  <header_html><![CDATA[<?php echo (

    ! is_null( $output = $new_config[ 'header_html' ] ) ?

    $output :

    (string) $this->stored_config()->{ 'header_html' }[0]

  ); ?>]]></header_html>

  <footer_html><![CDATA[<?php echo (

    ! is_null( $output = $new_config[ 'footer_html' ] ) ?

    $output :

    (string) $this->stored_config()->{ 'footer_html' }[0]

  ); ?>]]></footer_html>

  <canned_style>

    <id><?php echo $this->escape_xml(

      ! is_null( $output = $new_config[ 'canned_style' ][0] ) ?

      $output :

      (string) $this->stored_config()->{ 'canned_style' }[0]->{ 'id' }[0]

    ); ?></id>

  </canned_style>

  <css_includes>
<?php

$css_urls = (

  ! is_null( $output = $new_config[ 'css_includes' ][ 'css_urls' ] ) ?

  $output :

  $this->stored_config()->{ 'css_includes' }[0]

);

foreach ( $css_urls as $css_url ) {

  $css_url = $this->escape_xml( (string) $css_url );

  echo "
    <css_url>{$css_url}</css_url>
";

}
// foreach

?>

  </css_includes>

  <components>

    <images>

      <enabled><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'images' ][ 'enabled' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'images' }[0]->{ 'enabled' }[0]

      ); ?></enabled>

      <sort><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'images' ][ 'sort' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'images' }[0]->{ 'sort' }[0]

      ); ?></sort>

      <limit><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'images' ][ 'limit' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'images' }[0]->{ 'limit' }[0]

      ); ?></limit>

      <source_filter_id><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'images' ][ 'source_filter_id' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'images' }[0]->{ 'source_filter_id' }[0]

      ); ?></source_filter_id>

      <include_publication_images><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'images' ][ 'include_publication_images' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'images' }[0]->{ 'include_publication_images' }[0]

      ); ?></include_publication_images>

    </images>

    <articles>

      <enabled><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'articles' ][ 'enabled' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'articles' }[0]->{ 'enabled' }[0]

      ); ?></enabled>

      <sort><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'articles' ][ 'sort' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'articles' }[0]->{ 'sort' }[0]

      ); ?></sort>

      <limit><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'articles' ][ 'limit' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'articles' }[0]->{ 'limit' }[0]

      ); ?></limit>

      <include_image><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'articles' ][ 'include_image' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'articles' }[0]->{ 'include_image' }[0]

      ); ?></include_image>

      <include_scores><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'articles' ][ 'include_scores' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'articles' }[0]->{ 'include_scores' }[0]

      ); ?></include_scores>

    </articles>

    <quotes>

      <enabled><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'quotes' ][ 'enabled' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'quotes' }[0]->{ 'enabled' }[0]

      ); ?></enabled>

      <sort><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'quotes' ][ 'sort' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'quotes' }[0]->{ 'sort' }[0]

      ); ?></sort>

      <limit><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'quotes' ][ 'limit' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'quotes' }[0]->{ 'limit' }[0]

      ); ?></limit>

      <include_image><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'quotes' ][ 'include_image' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'quotes' }[0]->{ 'include_image' }[0]

      ); ?></include_image>

      <speakers>
<?php

$speakers = (

  ! is_null( $output = $new_config[ 'components' ][ 'quotes' ][ 'speakers' ] ) ?

  $output :

  $this->stored_config()->{ 'components' }[0]->{ 'quotes' }[0]->{ 'speakers' }[0]

);

foreach ( $speakers as $speaker_topic_id ) {

  $speaker_topic_id = $this->escape_xml( $speaker_topic_id );

  echo "
        <speaker_topic_id>{$speaker_topic_id}</speaker_topic_id>
";

}
// foreach

?>

      </speakers>

    </quotes>

    <connections>

      <enabled><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'connections' ][ 'enabled' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'connections' }[0]->{ 'enabled' }[0]

      ); ?></enabled>

      <sort><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'connections' ][ 'sort' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'connections' }[0]->{ 'sort' }[0]

      ); ?></sort>

      <limit><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'connections' ][ 'limit' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'connections' }[0]->{ 'limit' }[0]

      ); ?></limit>

      <include_image><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'connections' ][ 'include_image' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'connections' }[0]->{ 'include_image' }[0]

      ); ?></include_image>

      <include_topic_types>
<?php

$topic_types = (

  ! is_null( $output = $new_config[ 'components' ][ 'connections' ][ 'include_topic_types' ] ) ?

  $output :

  $this->stored_config()->{ 'components' }[0]->{ 'connections' }[0]->{ 'include_topic_types' }[0]

);

foreach ( $topic_types as $topic_type ) {

  $topic_type = $this->escape_xml( $topic_type );

  echo "
        <topic_type>{$topic_type}</topic_type>
";

}
// foreach

?>

      </include_topic_types>

    </connections>

    <stories>

      <enabled><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'stories' ][ 'enabled' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'stories' }[0]->{ 'enabled' }[0]

      ); ?></enabled>

      <limit><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'stories' ][ 'limit' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'stories' }[0]->{ 'limit' }[0]

      ); ?></limit>

      <term><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'stories' ][ 'term' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'stories' }[0]->{ 'term' }[0]

      ); ?></term>

      <sort><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'stories' ][ 'sort' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'stories' }[0]->{ 'sort' }[0]

      ); ?></sort>

    </stories>

    <timeline>

      <enabled><?php echo $this->escape_xml(

        ! is_null( $output = $new_config[ 'components' ][ 'timeline' ][ 'enabled' ] ) ?

        $output :

        (string) $this->stored_config()->{ 'components' }[0]->{ 'timeline' }[0]->{ 'enabled' }[0]

      ); ?></enabled>

    </timeline>

  </components>

</tpb-config>
